package com.pojo.id;

import cn.hutool.core.util.IdUtil;
import org.hibernate.HibernateException;
import org.hibernate.engine.spi.SharedSessionContractImplementor;

import java.io.Serializable;
import java.math.BigDecimal;

/**
 * 雪花ID生成
 */
public class SnowflowID implements  org.hibernate.id.IdentifierGenerator{
    @Override
    public Serializable generate(SharedSessionContractImplementor sharedSessionContractImplementor, Object o) throws HibernateException {
        Long id = IdUtil.getSnowflake(0,0).nextId();
        return id;
    }
}
